<template>
    <div class="hello">
        <h1>{{msg}}</h1>
        <button @click="count++">count is {{count}}</button>
    </div>
</template>

<script>
export default {
    name:"HelloWorld",

    props:{
        msg:String,
    },

    emits:["sayHello"],

    data(){
        return {
            count:0
        }
    },

    /*     
    beforeCreate
    created 

    beforeMount
    mounted

    beforeUpdate
    updated

    beforeUnmount
    unmounted
    */

    // beforeCreate(){
    //     console.log("HelloWorld beforeCreate");
    // },

    // created(){
    //     console.log("HelloWorld created");
    //     // this.$emit("sayHello","from HelloWorld")
    // },

    /* 
    Vue3的语法入口： 
    组件创建实例阶段就回调
    */
    // setup(props,context) {
    setup(props,{emit}) {
        console.log("HelloWorld setup",props);
        emit("sayHello","from HelloWorld/setup")
    }

}
</script>